import os
from http_get import get
from dotenv import load_dotenv

load_dotenv()

url_prefix = os.getenv('restUrl')
id = os.getenv('id')
print(url_prefix)

def send(urlPrefix, path, param):
  url = urlPrefix + path
  print(url)
  print(param)
  return get(url, param)

def sendSupportAccept(devCode, accept, workOrderId):
  print('send accept...')
  data = {}
  data['devCode'] = devCode
  data['accept'] = 1
  data['workOrderId'] = workOrderId
  return send(url_prefix, '/support', data)

def sendSupportDeny(devCode, accept, workOrderId):
  print('send deny...')
  data = {}
  data['devCode'] = devCode
  data['accept'] = 0
  data['workOrderId'] = workOrderId
  return send(url_prefix, '/support', data)

def sendWarning(devCode):
  print('send warning...')
  data = {}
  data['devCode'] = id
  return send(url_prefix, '/warning', data)

